import { DatePipe } from '@angular/common';
export class DateTimeUtils {
  private static datePipe: DatePipe = new DatePipe("en");

  /**
   * 获取ionic组件样式的当前时间
   */
 static getIonDateTime(date:Date): string {
    return DateTimeUtils.datePipe.transform(date, 'yyyy-MM-ddTHH:mm')
  }

static  getCurrentDate(): Date {
    return new Date();
  }

  /**
   * date增加小时后的ionic时间格式
   * @param date
   * @param hours
   */
  static getIonDateTimeAddHours(date:Date, hours:number):string{
    let time = date.getTime();
    let newDate = new Date(time);
    newDate.setHours(newDate.getHours() + hours);
    return DateTimeUtils.getIonDateTime(newDate);
  }







}
